#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    //设置标题
    QStringList list;
    ui->treeWidget->setHeaderLabels(list<<"英雄"<<"简介");
    //添加根节点
    QTreeWidgetItem *liliangItem = new QTreeWidgetItem(QStringList()<<"力量");
    QTreeWidgetItem *zhiliItem = new QTreeWidgetItem(QStringList()<<"智力");
    QTreeWidgetItem *miejieItem = new QTreeWidgetItem(QStringList()<<"敏捷");
    ui->treeWidget->addTopLevelItem(liliangItem);
    ui->treeWidget->addTopLevelItem(zhiliItem);
    ui->treeWidget->addTopLevelItem(miejieItem);
    //添加子节点
    liliangItem->addChild(new QTreeWidgetItem(QStringList()<<"猪刚列"<<"被攻击后反弹20%的伤害"));
    zhiliItem->addChild(new QTreeWidgetItem(QStringList()<<"小人月"<<"有10%的概率躲闪攻击"));
    miejieItem->addChild(new QTreeWidgetItem(QStringList()<<"小炮"<<"10%的几率触发暴击效果"));
}

Widget::~Widget()
{
    delete ui;
}
